package service.impl;

import dao.UserDao;
import dao.impl.UserDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.User;
import service.UserService;
import util.MyBatisUtil;

import java.util.List;
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public List<User> findAll(String , int offset, int pageSize) {
        return MyBatisUtil.getSession().getMapper(UserDao.class).findAll(user,offset,pageSize);
    }

    @Override
    public int count(User user) {
        return userDao.count(user);
    }

    @Override
    public User findById(Integer id) {
        return userDao.findById(id);
    }//3

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int deleteUserById(Integer id) {
        return userDao.deleteUserById(id);
    }


}
